package practise.sort.SortAlgrothim;

import java.util.Random;

/**
 * Created by richard on 5/11/14.
 */
public class TestSort extends SortUtil {

    public static void main(String[] args){
        int[] numbers = generateNum(10);

        System.out.println("bubble:");
        print(numbers);
        int tmp =numbers[0];
        swap(numbers,0,5);
        System.out.println(tmp);
        print(BubbleSort.sort(numbers));



        System.out.println("insertion:");
        print(numbers);
        print(SelectSort.sort(numbers));


        System.out.println("Quick:");
        print(numbers);
        print(QuickSort.sort(numbers));

    }

    public static void print(int[] numbers){
        for(int num: numbers){
            System.out.print("["+num+"]");
        }
        System.out.println();
    }

    public static int[] generateNum(int amount){
        int[] numbers = new int[amount];
        Random random = new Random(amount);
        for(int i =0; i<amount; i++){
            numbers[i]= random.nextInt()%amount;
        }
        return numbers;
    }
}
